package com.yu.rpc.core.protocol;

public enum ProtocolMessageStatusEnum {
    OK("ok", 20),
    BAD_REQUEST("bad_request", 40),
    BAD_RESPONSE("bad_response", 50);

    private final String text;
    private final int value;

    private ProtocolMessageStatusEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    public static ProtocolMessageStatusEnum getEnum(String value) {
        for (ProtocolMessageStatusEnum e : ProtocolMessageStatusEnum.values()) {
            if (e.text.equals(value)) {
                return e;
            }
        }
        return null;
    }
}
